<div class="main-content">
	<div class="breadcrumbs" id="breadcrumbs">
		<script type="text/javascript">
			try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
		</script>

		<!-- .breadcrumb -->
	</div>
	<!-- Main content -->
    <div class="page-content">
    	<div class="row">
    	    <div class="page-header">
    			<h1>查看发放详情</h1>
    		</div>
            <div class=" col-md-12 col-sm-12 col-xs-12 form">
                <div class="row">
                <form action="<?php echo base_url().'admin/activity/look_release/'.$coupon_id; ?>" method="get">
                	<div class="wh">
                    	<label>用户名：</label>
                        <input type="text"  name="card_name" value="<?php if (isset($card_name))echo $card_name;?>"/>
                  </div>
                  <div class="wh">
                    	<label>手机号：</label>
                        <input type="text"  name="login_name" value="<?php if (isset($login_name))echo $login_name;?>"/>
                  </div>
                    <div class="wh">
						<button class="btn btn-sm btn-info" type="submit"><i class="icon-search"></i>查询</button>
						<a class="btn btn-sm btn-info" href="<?php echo site_url("admin/upyun/choose_user/".$coupon_id) ?>" data-target="#staffModal" data-toggle="modal" ><i class="icon-search"></i>发放</a>
                        <a class="btn btn-sm btn-info" href="<?php echo site_url("admin/activity/export_no_use/".$coupon_id) ?>"  ><i class="icon-search"></i>导出未使用</a>
                        <a class="btn btn-sm btn-info" href="<?php echo site_url("admin/activity/add_user_by_excel/".$coupon_id) ?>"  ><i class="icon-search"></i>批量导入</a>
                    </div>
                </form>
                </div>
			</div>
			<div class="col-xs-12 margin_t margin_b">
				<div class="table-responsive  tab">
					<table id="sample-table-1" class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th>手机号</th>
                                <th>真实姓名</th>
                                <th>身份证号</th>
                                <th>开始时间</th>
                                <th>结束时间</th>
                                <th>发放时间</th>
                                <th>是否使用</th>
                                <th>操作</th>
							</tr>
						</thead> 
						<tbody>
						<?php if (isset($result)&&count($result)>0){
                            	foreach ($result as $device){
                            	?>
							<tr>
								<td><p><?php echo $device->login_name;?></p></td>
								<td><p><?php echo $device->card_name;?></p></td>
								<td><p><?php echo substr($device->cardno, 0,strlen($device->cardno)-4)."****";?></p></td>
								<td><p><?php echo date('Y-m-d H:i:s', $device->start_time);?></p></td>
								<td><p><?php echo date('Y-m-d H:i:s', $device->end_time);?></p></td>
                                <td><p><?php echo $device->create_time;?></p></td>
								<td><p><?php 
											if($device->status == 0){
												echo "未使用";
											}elseif($device->status == 1){
												echo "已使用";
											}
								?></p></td>
                                <td><p><button data-id="<?php echo $device->id?>" class="del">删除</button></p></td>
                                </tr>
    						<?php }
                            }else{?>
                            <tr>
                            	<td colspan="7">无数据</td>
                            </tr>
                            <?php }?>
                            </tbody>
                         </table>
                     </div><!-- /.table-responsive -->
            	</div>
            	<div class="col-sm-12">
                	<div class="modal-footer no-margin-top">
	                	<div class="pull-left record">
							共<?php echo $count;?>条记录
	                    </div>
                		<?php if (isset($page))echo $page;?>
                	</div>
                </div>
            </div><!-- /.row -->
		</div><!-- /.page-content -->
	</div><!-- /.main-content -->
    <script type="text/javascript">
        $('.del').click(function(){
            var id = $(this).attr('data-id');
            if(confirm('确认删除?')){
                $.post("<?php echo base_url().'admin/activity/delete_user_coupon'?>",{
                    id:id
                },function(res){
                    console.log(res);
                    var data = JSON.parse(res);
                    if(data.status){
                        alert('删除成功!');
                        window.location.reload();
                    }else{
                        alert('删除失败!');
                    }
                })
            }
            
        })
    </script>